package MonthGame.仓鼠;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        int tempn = s.nextInt();
        int n = (int) Math.pow(2,tempn);
        Map<Integer,Integer> map = new HashMap<>();
        int [] ans = new int[n+1];
        for(int i=1;i<=n;i++){
            int temp = s.nextInt();
            map.put(temp,i);
            ans[i] = temp;
        }
        for(int i=1;i<tempn;i++){
            for(int j=1;j<n;j+=Math.pow(2,i)){
                int ii = (int) Math.pow(2,i-1);
                if(ans[j]<ans[j+ii]) ans[j] = ans[j+ii];
            }
        }
        if(ans[1]<ans[(int) (1+Math.pow(2,tempn-1))])
        System.out.print(map.get(ans[1]));
        else  System.out.print(map.get(ans[(int) (1+Math.pow(2,tempn-1))]));
    }
}
